multiple templates

I'm trying to add multiple templates to a module vai DXL.

If I add two templates of different names this is fine e.g.

Template tDemoHead = template  "Scope of Module" <>
        "Referenced Docs" <>
        "Test Specifications"
        
Template tDemoTest = template  "Test A" <<
        "Description" <>
        "Configuration" <<
        "Equipment" <>
        "Pre-Requisites" <>
        "Assumptions / Notes" >>
        "Steps"

instance tDemoHead
instance tDemoTest

If I add a third template of a type already used, this causes DOORS to freeze and crash (without a message) e.g.

instance tDemoHead
instance tDemoTest
instance tDemoTest


peteduk - Fri Sep 27 06:55:20 EDT 2013

Re: multiple templates
llandale - Fri Sep 27 12:18:58 EDT 2013

Wow, never seen Templates before.  Quick testing shows:

  • The "Template" command does not create an object
  • The "instance" command does create an object
  • All the examples have a single "instance" command at the bottom.
  • Two "instance" commands crashed DOORS (for me)

So when considering using two "instance" commands for the same "Template"; take that Doctor's advise from the joke "Don't do that".

 

Re: multiple templates
peteduk - Mon Sep 30 02:02:29 EDT 2013

llandale - Fri Sep 27 12:18:58 EDT 2013

Wow, never seen Templates before.  Quick testing shows:

  • The "Template" command does not create an object
  • The "instance" command does create an object
  • All the examples have a single "instance" command at the bottom.
  • Two "instance" commands crashed DOORS (for me)

So when considering using two "instance" commands for the same "Template"; take that Doctor's advise from the joke "Don't do that".

 

Hi llandale

Thanks for the response - but why does the second instance call cause problems. From testing I can create as many templates as I like providing they have a different name - surely DOORS which is object orientated can create more than one instance of a particular object.

Is it possible to create a Template dynamically in code, changing it's name each time, then instantiate it?

Re: multiple templates
llandale - Tue Oct 01 14:59:26 EDT 2013

peteduk - Mon Sep 30 02:02:29 EDT 2013

Hi llandale

Thanks for the response - but why does the second instance call cause problems. From testing I can create as many templates as I like providing they have a different name - surely DOORS which is object orientated can create more than one instance of a particular object.

Is it possible to create a Template dynamically in code, changing it's name each time, then instantiate it?

I've never used them; but it sure appears to me that the "Template" unit created when you do this: Template t = template("whatever") gets used up when you issue the "instance" command.  My best guess is that the "template" and "instance" commands need to be paired exactly.

It's like ... well, "preparing" a dinner and then "eating" it.  Once you eat it you must prepare a new one.

-Louie

Re: multiple templates
kourosh - Wed Oct 02 11:59:34 EDT 2013

peteduk - Mon Sep 30 02:02:29 EDT 2013

Hi llandale

Thanks for the response - but why does the second instance call cause problems. From testing I can create as many templates as I like providing they have a different name - surely DOORS which is object orientated can create more than one instance of a particular object.

Is it possible to create a Template dynamically in code, changing it's name each time, then instantiate it?

I think you should raise a PMR with support to see if this is either a defect or at the very least, a doc defect.

But for a workaround, how about putting it in a loop to run as many times as you want?...

 

Template tDemoHead = template  "Scope of Module" <>
        "Referenced Docs" <>
        "Test Specifications"

instance tDemoHead
int i
for(i=0; i<2; i++)
{      
 Template tDemoTest = template  "Test A" <<
         "Description" <>
         "Configuration" <<
         "Equipment" <>
         "Pre-Requisites" <>
         "Assumptions / Notes" >>
         "Steps"

 instance tDemoTest
}